package com.realtyManage.springboot.Service.impl;

import com.realtyManage.springboot.Dao.HouseDetailRepository;
import com.realtyManage.springboot.Model.Do.HouseDetail;
import com.realtyManage.springboot.Service.IIndexService;
import com.realtyManage.springboot.Service.ISpecialOfferHouseService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;

/**
 * IndexServiceImpl
 *
 * @Author 杭州素色网络科技有限公司
 * @Date 2019/3/22
 **/
@Service
@Transactional
public class IndexServiceImpl implements IIndexService{
    @Autowired
    private HouseDetailRepository houseDetailRepository;

    @Autowired
    private ISpecialOfferHouseService specialOfferHouseService;

    @Override
    public HouseDetail getHouseDetail(Integer hid) {
        HouseDetail houseDetail = houseDetailRepository.getOne(hid);


        List<String> logoList = new ArrayList<String>();
       /*if (houseDetail.getLogo() != null && houseDetail.getLogo() != "") {
            String[] logos = houseDetail.getLogo().split(",");
            for (String str : logos) {
                logoList.add(str);
            }
        }*/
       /* houseDetail.setLogo(StringUtils.join(logoList.toArray(), ","));
        List<String> mainTypeLogoList = new ArrayList<String>();
        if (houseDetail.getMainTypeLogo() != null && !"".equals(houseDetail.getMainTypeLogo())) {
            String[] typeLogos = houseDetail.getMainTypeLogo().split(",");
            for (String str : typeLogos) {
                *//*mainTypeLogoList.add(OssUtil.getUrl(str));*//*
                mainTypeLogoList.add(str);
            }
        }*/
        //统计特价房数量
        /*houseDetail.setCustNum(specialOfferHouseService.countByRelevanceHouseId(hid));
        houseDetail.setMainTypeLogo(StringUtils.join(mainTypeLogoList.toArray(), ","));*/
        return houseDetail;
    }

}
